<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        #box {
            width: 300px;
            height: 300px;
            background-color: bisque;
            margin-left: 200px;
            margin-top: 300px;
        }
    </style>
</head>

<body>
    <button id="btn" onclick="console.log('hi');">button</button>
    <script>
        /*
            1.特性同步属性（属性根据特性创建的）
            2.属性事件处理函数的优先级高于特性
        */
        const btn = document.getElementById('btn');
        btn.onclick = function () {
            console.log('hello');
        }

        // console.log(btn.onclick);
        // console.log(btn.getAttribute('onclick'));
    </script>
</body>

</html>